new Vue({
    el:'#app',
    data:{
        goods:[
            {
                id:'001',
                name:'手机',
                price:2299,
                num:0,
                kucun:8
            },
            {
                id:'002',
                name:'电脑',
                price:5999,
                num:0,
                kucun:10
            },
            {
                id:'003',
                name:'音响',
                price:299,
                num:0,
                kucun:6
            },
            {
                id:'004',
                name:'键盘',
                price:199,
                num:0,
                kucun:2
            }
        ]
    },
    computed:{
        sum(){
            let totle = 0;
            this.goods.forEach(function(items){
                totle += items.price*items.num;
            });
            return totle;
        }
    }
})